﻿using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;

namespace PLCSharpWpf.wpf
{
    //红灰
    public class BoolToColorRorG : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            bool colorValue = System.Convert.ToBoolean(value);
            return colorValue ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.Gray);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

    //亮绿与灰
    public class BoolToColorLorG : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            bool colorValue = System.Convert.ToBoolean(value);
            return colorValue ? new SolidColorBrush(Colors.Lime) : new SolidColorBrush(Colors.Gray);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
